home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / PAS_0493 / WINDOWS.PAS < prev    next >
Pascal/Delphi Source File  |  1993-04-22  |  2KB  |  67 lines

  1. {─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
  2. Msg  : 247 of 267
  3. From : Salim Samaha                        1:167/110.0          14 Apr 93  16:28
  4. To   : Tyson Brown
  5. Subj : Pop-Up menus.
  6. ────────────────────────────────────────────────────────────────────────────────
  7. If I remember right, you wanted to know how to open and close windows in text
  8. mode, here is a unit I wrote a while ago. I hope it helps. }
  9.  
  10. Unit Windows;
  11. Interface
  12. Uses Crt;
  13.  
  14. Const
  15.    Max = 3;
  16.  
  17. Type
  18.    ScreenImage = Array[0..1999] of word;
  19.    FrameRec    = Record
  20.                     Upperleft    : Word;
  21.                     LowerRight   : Word;
  22.                     ScreenMemory : ScreenImage;
  23.                  End;
  24.  
  25. VAR
  26.    SnapShot     : ^ScreenImage;
  27.    FrameStore   : Array [1..10] of ^FrameRec;
  28.    WindowNum    : Byte;
  29.  
  30. Procedure OpenWindow(UpLeftX,UpLeftY,LoRightX,LoRightY : Byte);
  31. Procedure CloseWindow;
  32.  
  33. Implementation
  34.  
  35. Procedure OpenWindow(UpLeftX,UpLeftY,LoRightX,LoRightY : Byte);
  36. Begin
  37.    SnapShot := Ptr( $B800, $0000);
  38.    Inc(WindowNum);
  39.    New(FrameStore[WindowNum]);
  40.    WITH Framestore[WindowNum]^ do
  41.    Begin
  42.       ScreenMemory := SnapShot^;
  43.       UpperLeft    := WindMin;
  44.       LowerRight   := WindMax;
  45.    end;
  46.    Window(UpLeftX,UpLeftY,LoRightX,LoRightY);
  47. end;
  48.  
  49. Procedure CloseWindow;
  50. Begin
  51.    With Framestore[WindowNum]^ do
  52.    Begin
  53.       Snapshot^ := ScreenMemory;
  54.       Window ( (Lo(UpperLeft)+1), (Hi(UpperLeft)+1),
  55.              (Lo(LowerRight)+1), (Hi(LowerRight)+1) );
  56.    end;
  57.    Dispose( Framestore[WindowNum]);
  58.    Dec(WindowNum);
  59. End;
  60.  
  61. Begin
  62. End.
  63.  
  64.  
  65. If you have any questions on this unit, feel free to ask.
  66.  
  67.                                 SAL